import { BirthdayRemind } from '@/types/birthdayRemind'
import { Pagination, PageResult, PageParam } from '@/types/global'
import { About } from '@/types/home'
import { Order } from '@/types/order'
import { Search, SearchItem } from '@/types/search'
import { TalkRecord } from '@/types/talkRecord'
import { http } from '@/utils/http'

type MyParams = Pagination & { subType?: string } // 定义类型 类型是Pagination的属性 + subType属性

export const searchApi = (type: number, name: string) => {
  return http.get<Search>('/bk/global/search', { type, name })
}

export const searchOrderApi = (direction: number, name: string) => {
  return http.get<Order[]>('/bk/global/searchOrder', { direction, name })
}

export const searchCollectionApi = (type: number, id: number) => {
  return http.post<any>('/bk/global/searchCollection', { type, id })
}

export const searchTopListApi = (type: number) => {
  return http.get<SearchItem[]>('/bk/global/searchTopList', { type })
}

export const getNoticeContentApi = () => {
  return http.get<string>('/bk/global/getNoticeContent')
}

export const getReportDataListApi = () => {
  return http.get<any[][]>('/bk/global/getReportDataList')
}

export const getGuessListApi = (param: PageParam) => {
  return http.get<PageResult<SearchItem>>('/bk/global/getGuessList', param)
}

export const feedbackApi = (type: number, remarks: string) => {
  return http.post<any>('/bk/global/feedback', { type, remarks })
}

export const aboutApi = () => {
  return http.get<About>('/bk/global/about')
}

export const birthdayRemindApi = (data: BirthdayRemind) => {
  return http.post<any>('/bk/global/birthdayRemind', data)
}

export const generateTalkRecordApi = (data: TalkRecord) => {
  return http.post<any>('/bk/global/generateTalkRecord', data)
}
